package com.cebbank.yyi.springbootapp.jingtang.service.impl;

import com.cebbank.yyi.springbootapp.jingtang.entity.RcDocAttachment;
import com.cebbank.yyi.springbootapp.jingtang.dao.RcDocAttachmentDao;
import com.cebbank.yyi.springbootapp.jingtang.service.RcDocAttachmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 文档附件列表(RcDocAttachment)表服务实现类
 *
 * @author makejava
 * @since 2024-08-22 10:34:43
 */
@Service("rcDocAttachmentService")
public class RcDocAttachmentServiceImpl implements RcDocAttachmentService {
    @Resource
    private RcDocAttachmentDao rcDocAttachmentDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public RcDocAttachment queryById(String id) {
        return this.rcDocAttachmentDao.queryById(id);
    }

//    /**
//     * 分页查询
//     *
//     * @param rcDocAttachment 筛选条件
//     * @param pageRequest      分页对象
//     * @return 查询结果
//     */
//    @Override
//    public Page<RcDocAttachment> queryByPage(RcDocAttachment rcDocAttachment, PageRequest pageRequest) {
//        long total = this.rcDocAttachmentDao.count(rcDocAttachment);
//        return new PageImpl<>(this.rcDocAttachmentDao.queryAllByLimit(rcDocAttachment, pageRequest), pageRequest, total);
//    }

    /**
     * 新增数据
     *
     * @param rcDocAttachment 实例对象
     * @return 实例对象
     */
    @Override
    public RcDocAttachment insert(RcDocAttachment rcDocAttachment) {
        this.rcDocAttachmentDao.insert(rcDocAttachment);
        return rcDocAttachment;
    }

    /**
     * 修改数据
     *
     * @param rcDocAttachment 实例对象
     * @return 实例对象
     */
    @Override
    public RcDocAttachment update(RcDocAttachment rcDocAttachment) {
        this.rcDocAttachmentDao.update(rcDocAttachment);
        return this.queryById(rcDocAttachment.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.rcDocAttachmentDao.deleteById(id) > 0;
    }
}
